<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    a{
      height: 100px !important;
    }
  </style>
</head>
<body>
  <script>
    // 手写instanceof
    function myInstanceof(left, right){
      if(typeof left !=='object' || left === null ) return false
      while(true){
        if(left === null) return false
        if(left.__proto__ === right.prototype){
          return true
        }
        left = left.__proto__
      }
    }
    class Obj{}
    let obj = new Obj()
    console.log(myInstanceof(obj,Obj))
    console.log(myInstanceof(obj,Object))
    console.log(myInstanceof(obj,Function))
    console.log(myInstanceof(1,Object))
    console.log(myInstanceof(null,Object))
  </script>
</body>
</html>